import java.util.Scanner;
public class Find {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] num = new int[N];
        int max = 0, temp, max_t = 0;
        for (int i = 0; i < N; i++)
        {
            num[i] = sc.nextInt();
            max_t += num[i];
        }
        for(int i = 0; i < N; i++)
        {
            
            for(int j = i+1; j < N; j++)
            {
                temp = 0;
                for(int m = i; m <= j; m++)
                {
                    temp += num[m];
                }
                if(temp >= max && temp != max_t)
                {
                    max = temp;
                }
            }
        }
        System.out.println("max:" + max);
        sc.close();
    }
}